var nr = document.getElementById("nr");

printElement(nr);

function printElement(e,forece) {
    while (e != document.body) {
        e.style.margin="0px";
        e.style.padding="0px";
        var es = e.previousElementSibling;
        while (es != null) {
            var temp = es.previousElementSibling;
            if(forece){
                es.remove();
            }
            else {
                es.style.display="none";
            }
            es = temp;
        }

        es = e.nextElementSibling;
        while (es != null) {
            temp = es.nextElementSibling;
            if(forece){
                es.remove();
            }
            else {
                es.style.display="none";
            }
            es = temp;
        }

        e = e.parentElement;
    }
    window.print();
}